package com.example.rk.mapper;

import com.example.rk.entity.*;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

import java.util.List;

@Mapper
@Component
public interface ChoiceMapper {

    @Select("select * from choice where title=#{title} and type=#{type}")
    Choice findadd(@Param("title")String title, @Param("type")String type);
    @Insert("insert into choice (title,type) values(#{title},#{type})")
    void create(Choice choice);
    List<Choice>  findBySearch(String title);
    @Delete("delete from choice where id=#{id}")
    void deleteById(int id);

    List<Reply> findBySearch1(String title, int cid);
    @Select("select * from reply where id=#{id}")
    Reply findById(int id);
    @Delete("delete from reply where id=#{id}")
    void deleteById1(int id);

    List<Choice> findBySearch2(String title, String type, int sid);
    @Select("select * from choice where id=#{id}")
    Choice findById1(int id);
    @Insert("insert into reply (name,content,sid,title,cid) values(#{name},#{content},#{sid},#{title},#{cid})")
    void create1(Reply reply);

    List<Contract> findBySearch4(String name);

    List<Choice> findBySearch3(String name, String dizhi);
    @Update("update admin set type='公司' where id=#{id}")
    void fingByIdty(int id);
    @Select("select * from changest where id=#{id}")
    Changest fingByIdtp(int id);
    @Delete("delete from changest where id=#{id}")
    void deleteById2(int id);
    @Select("select cid from changest where id=#{id}")
    int find(int id);
    @Select("select * from contract where content=#{content}")
    Contract findjy(String content);
    @Insert("insert into contract (name,content,cid) values(#{name},#{content},#{cid})")
    void createjy(Contract contract);
    @Delete("delete from contract where id=#{id}")
    void jydelte(int id);
    @Delete("delete from admin where id=#{id}")
    void jyfindById(int id);
    @Select("select cid from contract where id=#{id}")
    int jyfind(int id);
    @Select("select name from changest where id=#{id}")
    String findname(int id);
    @Update("update admin set name=#{name} where id=#{id}")
    void setname(@Param("name")String name,@Param("id")int id);
    @Select("select cid from reply where id=#{id}")
    int fingcid(int id);
//    @Insert("insert into choice (title,type) values(#{title},#{type}")
//    void create(@Param("title") String title,@Param("type")  String type);
}
